use std::{rc::{Weak, Rc}, cell::RefCell};

use crate::vulkan::object::object::{Componentable, ComponentableContext};

use super::super::object::Object;

// pub trait ObjectComponent {
//     fn post_load(&mut self, parent_object: Rc<RefCell<dyn Object>>);
// }

#[derive(Default, Clone)]
pub struct BaseComponent {
    parent_object: Option<Weak<RefCell<dyn Object>>>
}

impl Componentable for BaseComponent {
    fn post_load(&mut self, parent_object: Rc<RefCell<dyn Object>>, context: &mut ComponentableContext) {
        self.parent_object = Some(Rc::downgrade(&parent_object));
    }
}